<template>
    <div id="app">
        <keep-alive :include="['course-config', 'course-poster']">
            <router-view v-wechat-title="$route.meta.title"></router-view>
        </keep-alive>
    </div>
</template>

<script>
    const wx = require('weixin-js-sdk');
    export default {
        data() {
            return {
                share: {
                    courseName: '乐乐妈妈的知识分享课',
                    courseDesc: '这是一个有关于0-3岁宝宝教育启蒙的知识分享课',
                    holderId: 12,
                    visitorId: 13
                }
            }
        },
        components: {},
        created(){
            // this.initShareSDK()
        },
        mounted() {
            this.initPage()
        },
        methods: {
            initPage() {
                (function(doc, win) {
                    // 移动端REM自适应
                    var docEl = doc.documentElement,
                        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                        recalc = function() {
                            var clientWidth = docEl.clientWidth || 375;
                            var width = clientWidth < 375 ? 375 : clientWidth > 640 ? 640 : clientWidth;
                            docEl.style.fontSize = 100 * (width / 375) + 'px';
                            docEl.style.opacity = 1;
                        };
                    docEl.style.opacity = 0;
                    win.addEventListener(resizeEvt, recalc, false);
                    doc.addEventListener('DOMContentLoaded', recalc, false);
                    // IOS8下1px线条改为0.5px
                    if (/iP(hone|od|ad)/.test(navigator.userAgent)) {
                        var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/),
                            version = parseInt(v[1]);
                        if (version >= 8) {
                            document.documentElement.classList.add('hairlines');
                        }
                    }
                })(document, window);
            },
        },
    }
</script>


<style lang="scss">
</style>